/**
 * Async recursion implementation
 * @author Janez Dolinar <info@tuksi.net>
 */
var sourceObj = [
    'source1',
    [
        'source1-1',
        [
            'source1-1-1',
            'source1-1-2',
            'source1-1-3',
        ],
        'source-1-2'
    ]
];


function recursion(passArr, parentObj) {
    var current;
    if (passArr.length == 0) {
        passArr = parentObj;
    }
    current = passArr.shift();

    switch (typeof current) {
        case 'string':
            console.log('Found string: '+current);
            setTimeout(function() {
                recursion(passArr, parentObj);
            },1000);

            break;
        case 'object':
            console.log('Found array, calling recursion');
            setTimeout(function() {
                recursion(current, passArr);
            },1000);
            break;
    }
}

recursion(sourceObj);